#!/bin/bash
lld_mysql_log=/home/myzabbix/zabbix.lld.mysql.log
keys="innodb_lock_waits|innodb_trx|Queries|Binlog_cache_disk_use|Binlog_stmt_cache_disk_use|"\
"Created_tmp_disk_tables|Key_read_requests|Key_reads|Max_used_connections|Open_tables|"\
"Opened_tables|Sort_merge_passes|Threads_cached|Threads_connected|Threads_created"

if source /etc/zabbix/zabbix_agentd.d/user.global.cfg; then
	lld_mysql_tmp="$(mysql -u"${rdsChaxunUser}" -p"${rdsChaxunPassword}" -h"${rdsIP}" -N -e "show global status;
		select 'innodb_lock_waits',count(*) from information_schema.innodb_lock_waits;
		select 'innodb_trx',count(*) from information_schema.innodb_trx")"
	echo "${lld_mysql_tmp}" | grep -E "${keys}" > ${lld_mysql_log}
	[[ "${lld_mysql_tmp}" != "" ]] && echo '1' || echo '0'
else
	echo '0'
fi 2>/dev/null
